package com.zj.fx.service.rpa;

import java.util.List;
import java.util.Arrays;

import com.zj.fx.mapper.rpa.RpaFetchreliabilityMapper;
import com.zj.fx.model.rpa.RpaFetchreliability;
import com.zj.fx.model.rpa.RpaFetchreliabilityExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.hutool.core.util.StrUtil;
import com.zj.fx.common.base.BaseService;
import com.zj.fx.common.support.ConvertUtil;
import com.zj.fx.model.custom.Tablepar;
import com.zj.fx.util.SnowflakeIdWorker;
import com.zj.fx.util.StringUtils;

/**
 * RPA抓取供电可靠率数据表 RpaFetchreliabilityService
 *
 * @author SQL_自动生成
 * @Title: RpaFetchreliabilityService.java 
 * @Package com.zj.fx.service 
 * @email ${email}
 * @date 2023-10-10 16:21:34  
 **/
@Service
public class RpaFetchreliabilityService implements BaseService<RpaFetchreliability, RpaFetchreliabilityExample> {
    @Autowired
    private RpaFetchreliabilityMapper rpaFetchreliabilityMapper;


    /**
     * 分页查询
     *
     * @param tablepar
     * @param rpaFetchreliability
     * @return
     */
    public PageInfo<RpaFetchreliability> list(Tablepar tablepar, RpaFetchreliability rpaFetchreliability) {
        RpaFetchreliabilityExample testExample = new RpaFetchreliabilityExample();
        //搜索
        if (StrUtil.isNotEmpty(tablepar.getSearchText())) {//小窗体
            testExample.createCriteria().andLikeQuery2(tablepar.getSearchText());
        } else {//大搜索
            testExample.createCriteria().andLikeQuery(rpaFetchreliability);
        }
        //表格排序
        //if(StrUtil.isNotEmpty(tablepar.getOrderByColumn())) {
        //	testExample.setOrderByClause(StringUtils.toUnderScoreCase(tablepar.getOrderByColumn()) +" "+tablepar.getIsAsc());
        //}else{
        //	testExample.setOrderByClause("id ASC");
        //}
        PageHelper.startPage(tablepar.getPage(), tablepar.getLimit());
        List<RpaFetchreliability> list = rpaFetchreliabilityMapper.selectByExample(testExample);
        PageInfo<RpaFetchreliability> pageInfo = new PageInfo<RpaFetchreliability>(list);
        return pageInfo;
    }

    @Override
    public int deleteByPrimaryKey(String ids) {

        List<String> lista = ConvertUtil.toListStrArray(ids);
        RpaFetchreliabilityExample example = new RpaFetchreliabilityExample();
        example.createCriteria().andIdIn(lista);
        return rpaFetchreliabilityMapper.deleteByExample(example);


    }


    @Override
    public RpaFetchreliability selectByPrimaryKey(String id) {

        return rpaFetchreliabilityMapper.selectByPrimaryKey(id);

    }


    @Override
    public int updateByPrimaryKeySelective(RpaFetchreliability record) {
        return rpaFetchreliabilityMapper.updateByPrimaryKeySelective(record);
    }


    /**
     * 添加
     */
    @Override
    public int insertSelective(RpaFetchreliability record) {

        //添加雪花主键id
        record.setId(SnowflakeIdWorker.getUUID());


        return rpaFetchreliabilityMapper.insertSelective(record);
    }


    @Override
    public int updateByExampleSelective(RpaFetchreliability record, RpaFetchreliabilityExample example) {

        return rpaFetchreliabilityMapper.updateByExampleSelective(record, example);
    }


    @Override
    public int updateByExample(RpaFetchreliability record, RpaFetchreliabilityExample example) {

        return rpaFetchreliabilityMapper.updateByExample(record, example);
    }

    @Override
    public List<RpaFetchreliability> selectByExample(RpaFetchreliabilityExample example) {

        return rpaFetchreliabilityMapper.selectByExample(example);
    }


    @Override
    public long countByExample(RpaFetchreliabilityExample example) {

        return rpaFetchreliabilityMapper.countByExample(example);
    }


    @Override
    public int deleteByExample(RpaFetchreliabilityExample example) {

        return rpaFetchreliabilityMapper.deleteByExample(example);
    }


}
